<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>项目流转单管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#btnImport").click(function(){
				$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true}, 
					bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<div id="importBox" class="hide">
		<form id="importForm" action="${ctx}/zx/lzd/import" method="post" enctype="multipart/form-data"
			class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
			<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>　　
			<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   "/>
			<a href="${ctx}/zx/lzd/import/template">下载模板</a>
		</form>
	</div>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/zx/lzd/">项目列表</a></li>
		<shiro:hasPermission name="zx:lzd:edit"><li><a href="${ctx}/zx/lzd/form">项目信息添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="lzd" action="${ctx}/zx/lzd/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li>
				<label>项目编号：</label>
				<form:input path="proNo" htmlEscape="false" maxlength="100" class="input-medium"/>
			</li>
			<li>
				<label>项目分类：</label>
				<sys:treeselect id="cgml" name="cgml.id" value="${lzd.cgml.id}" labelName="cgml.name" labelValue="${lzd.cgml.name}"
					title="项目具体分类" url="/zx/cgml/treeData" cssClass="required" />
			</li>
			<li>
				<label>关键字：</label>
				<form:input path="remarks" htmlEscape="false" maxlength="100" class="input-medium"/>
			</li>
			<li class="clearfix"></li>
			<li>
				<label>项目名称：</label>
				<form:input path="proName" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li>
				<label>项目具体分类：</label>
				<sys:treeselect id="keyword" name="keyword.id" value="${lzd.keyword.id}" labelName="keyword.name" labelValue="${lzd.keyword.name}"
					title="项目具体分类" url="/zx/keyword/treeData" cssClass="required" />
			</li>
			<li>
				<label>客户分类：</label>
				<form:select path="customType" cssStyle="width:177px">
					<form:option value="">请选择</form:option>
					<form:options items="${fns:getDictList('custom_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li class="btns">
				<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
				<input id="btnImport" class="btn btn-primary" type="button" value="导入"/>
			</li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>项目名称</th>
				<!-- <th>是否分标段</th> -->
				<th>项目编号</th>				
				<th>项目类型</th>
				<!-- <th>项目执行人</th> -->
				<th>项目负责人</th>
				<th>招标方式</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="lzd">
			<tr>
				<td> 
					${lzd.proName}
					<span class="label label-success" style="margin-left: 5px;font-size: 90%;font-weight: 400;">${lzd.ts.sectionName}</span>
					 <c:choose>
						<c:when test="${lzd.isSubpackage eq '1'}">
							<c:if test="${lzd.ts.trashPro eq '0'}">
								<span class="label label-warning" style="margin-left: 5px;font-size: 90%;font-weight: 400;" title="废标原因：${lzd.ts.trashContent}">废标</span>
							</c:if>
							<c:if test="${not empty lzd.ts.resetSectionId}">
								<span class="label label-info" style="margin-left: 5px;font-size: 90%;font-weight: 400;">${lzd.ts.restartCount}次</span>
							</c:if>
						</c:when>
						<c:otherwise>
							<c:if test="${lzd.trashPro eq '0'}">
								<span class="label label-warning" style="margin-left: 5px;font-size: 90%;font-weight: 400;" title="废标原因：${lzd.trashContent}">废标</span>
							</c:if>
							<c:if test="${not empty lzd.resetLzdId}">
								<span class="label label-info" style="margin-left: 5px;font-size: 90%;font-weight: 400;">${lzd.restartCount}次</span>
							</c:if>
						</c:otherwise>
					</c:choose>
				</td>
				<%-- <td>
					<c:if test="${lzd.isSubpackage eq '1'}">
						<span class="label label-success" style="margin-left: 5px;text-align:center; font-size: 90%;font-weight: 400;width: 30px">分</span>
					</c:if>
					<c:if test="${lzd.isSubpackage eq '2'}">
						<span class="label label-default" style="margin-left: 5px;text-align:center;font-size: 90%;font-weight: 400;width: 30px">不分</span>
					</c:if>
				</td> --%>
				<td>
					${lzd.proNo}
				</td>
				<td>
					${lzd.cgml.name}
				</td>
				<%-- <td>
					${lzd.proPerformer}
				</td> --%>
				<td>
					${lzd.proPic}
				</td>
				<td>
					${fns:getDictLabel(lzd.tenderWay, 'tender_way', '无')}
				</td>
			
				<td>
					<shiro:hasPermission name="zx:lzd:view">
    					<a href="${ctx}/zx/lzd/show?id=${lzd.id}">查看详情</a>&nbsp;&nbsp;
    				</shiro:hasPermission>
					<shiro:hasPermission name="zx:lzd:edit">
						<c:choose>
							<c:when test="${lzd.isSubpackage eq '1'}">
								<c:if test="${lzd.ts.trashPro != '0'}">
									<c:if test="${(currentUser.id eq lzd.createBy.id || currentUser.loginName eq 'admin')}">
										<a href="${ctx}/zx/lzd/form?id=${lzd.id}">修改</a>&nbsp;&nbsp;
										<a href="${ctx}/zx/lzd/delete?id=${lzd.id}" onclick="return confirmx('确认要删除该项目流转单吗？', this.href)">删除</a>
									</c:if>
									
								</c:if>
								<c:if test="${lzd.ts.trashPro eq '0'}">
									<a href="${ctx}/zx/lzd/restartForm?id=${lzd.id}&sectionId=${lzd.ts.id}">重新开标</a>&nbsp;&nbsp;
									<a href="${ctx}/zx/lzd/delete?id=${lzd.id}" onclick="return confirmx('确认要删除该项目流转单吗？', this.href)">删除</a>
								</c:if>
							</c:when>
							<c:otherwise>
								<c:if test="${lzd.trashPro != '0'}">
									<c:if test="${(currentUser.id eq lzd.createBy.id || currentUser.loginName eq 'admin')}">
										<a href="${ctx}/zx/lzd/form?id=${lzd.id}">修改</a>&nbsp;&nbsp;
										<a href="${ctx}/zx/lzd/delete?id=${lzd.id}" onclick="return confirmx('确认要删除该项目流转单吗？', this.href)">删除</a>
									</c:if>
								</c:if>
								<c:if test="${lzd.trashPro eq '0'}">
									<a href="${ctx}/zx/lzd/restartForm?id=${lzd.id}&sectionId=${lzd.ts.id}">重新开标</a>&nbsp;&nbsp;
									<a href="${ctx}/zx/lzd/delete?id=${lzd.id}" onclick="return confirmx('确认要删除该项目流转单吗？', this.href)">删除</a>
								</c:if>
							</c:otherwise>
						</c:choose>
						
					</shiro:hasPermission>
    				
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>